<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<!-- 
	Explain: EL
	
	The Expression Language is a special purpose programming language mainly used to access Java Beans and execute simple 
	code fragments from web pages (JSF and JSP).
-->

<h:head>
</h:head>
<h:body>

	<h:messages />

	<h1>Expression Language (EL)</h1>	
	<h2>Evaluate simple expressions: </h2>
	<h:outputText value="\#{1}" /> = <h:outputText value="#{1}" /> <br />
	<h:outputText value="\#{1+2}" /> = <h:outputText value="#{1+2}" /> <br />
	<h:outputText value="\#{1 == 1}" /> = <h:outputText value="#{1 == 1}" /> <br />
	<h:outputText value="\#{'1' == '1'}" /> = <h:outputText value="#{'1' == '1'}" /> <br />
	
	<h2>Access managed beans: </h2>
	<h:outputText value="\#{user}" /> = <h:outputText value="#{user}" /> <br />
	(It's always the same instance because it's session scoped!) <br />
	
	<h2>Access properties: </h2>
	<h:outputText value="\#{user.languages[0]}" /> = <h:outputText value="#{user.languages[0]}" /> <br />
	<h:outputText value="\#{user.languages[0].name}" /> = <h:outputText value="#{user.languages[0].name}" /> <br />
	<h:outputText value="\#{user.languages[0]['name']}" /> = <h:outputText value="#{user.languages[0]['name']}" /> <br />
	<h:outputText value="\#{user.createion}" /> = <h:outputText value="#{user.creationDate.toString()}" />  <br />
	
	<h2>Methods:</h2>
	<h:outputText value="\#{'ab'.length()}" /> = <h:outputText value="#{'ab'.length()}" /> <br />

	<h2>Predifined objects (non-exhaustive list): </h2>
	<ul>
		<li>header: A map of HTTP header parameters</li>
		<li>param: A map of HTTP request parameters</li>
		<li>cookie: A map of the cookie names and values of the current request </li>
		<li>facesContext: The FacesContext instance of this request</li>
		<li>view: The UIViewRoot instance of this request</li>
	</ul>
	<ui:debug /> <!-- Use Shift/Ctrl-D  to show debug info -->
</h:body>

</html>